UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RxKrE+ADa3Ua7xokLLzP65E4tbidzaKNFVis1Ki37c4=' 
WHERE 
  key_id = '917334686219f18b24f94d9d630c0ce5a9646a7d443abc71e37dc89fbd13be17' 
  AND (
    token = 'RxKrE+ADa3Ua7xokLLzP65E4tbidzaKNFVis1Ki37c4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026