UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QjJ5c5q9eCO1jjP47Kzucera+m2rw2G70rtmAARjCnU=' 
WHERE 
  key_id = 'e44e41d9782e56f8ee8f4ef1e947abf7c8f2b0a17e820123ed2216ee2f320b86' 
  AND (
    token = 'QjJ5c5q9eCO1jjP47Kzucera+m2rw2G70rtmAARjCnU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037