UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UyJfcpFTns95f9LA4DWa3kKIPu7206lBwmS8z6uma7Q=' 
WHERE 
  key_id = '70f6bd1c77a0962ad7b2e9455d50cf4f49555878fc388086fd9064237e47d160' 
  AND (
    token = 'UyJfcpFTns95f9LA4DWa3kKIPu7206lBwmS8z6uma7Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027