UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2fA4PhbI6SZ489n7N9jeFAo3aKGG/oCmqUT1MXk5+34=' 
WHERE 
  key_id = '51742e15845bdedd226ebb2c4de9c660b42a069a17eeb7cc3cc95c8d6fac39f5' 
  AND (
    token = '2fA4PhbI6SZ489n7N9jeFAo3aKGG/oCmqUT1MXk5+34=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025