UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'me5Zk14ba5X3MmNZXEBlaP7NEK4goCQywTnMmOM/x2U=' 
WHERE 
  key_id = '522cb83b93386eeaff57efe9f8a49614eda2fb66c22c0ce4695a36f568b127dc' 
  AND (
    token = 'me5Zk14ba5X3MmNZXEBlaP7NEK4goCQywTnMmOM/x2U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034