UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mXmRV65l8KA9YQVnqEGNMYpMZiLzP/f32aRgKqGtHEM=' 
WHERE 
  key_id = '62e7d5f2a167bbb85e284d2afb642b77bad416904bfce305fa23b76275370839' 
  AND (
    token = 'mXmRV65l8KA9YQVnqEGNMYpMZiLzP/f32aRgKqGtHEM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021