UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uGkbuGkA6x/TJ2Sgobd3SDF1RUzn6+IoWJCd5pVJydw=' 
WHERE 
  key_id = '7a4dfd978cb1708567184747761b51da86afcd48034fbaa263e3e9a85527ab87' 
  AND (
    token = 'uGkbuGkA6x/TJ2Sgobd3SDF1RUzn6+IoWJCd5pVJydw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048