UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'S7Ogkc4QCrk0ZuCII6FfPiZ4pp1T0ooUUnGmmjprHpE=' 
WHERE 
  key_id = '8ee0c1bd86d439d7e35f9e200c9ad1a74b2452fd33be956586b85fe808930817' 
  AND (
    token = 'S7Ogkc4QCrk0ZuCII6FfPiZ4pp1T0ooUUnGmmjprHpE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035