UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'c2MH20qpMvya0YTn2XNuePU3kDi18klol+3fdk7lRLk=' 
WHERE 
  key_id = '45cd93436f0c62bcd707d4d410c764bac28ef8128e1c4bc5bf9d3987b1962248' 
  AND (
    token = 'c2MH20qpMvya0YTn2XNuePU3kDi18klol+3fdk7lRLk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043