UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DY+7x4GqhNFBA4a97o6pDwBTUPURwgg1aGmu/+XAn60=' 
WHERE 
  key_id = 'ac5cae3bb077283471d0e6be9b599bc68fb2fc03618a2ee8eeaad068882a67b2' 
  AND (
    token = 'DY+7x4GqhNFBA4a97o6pDwBTUPURwgg1aGmu/+XAn60=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025