UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'j6pqI1Rc/lMwiGrL1OYL5Fln5tm97zRV8j9NkPvNVYY=' 
WHERE 
  key_id = '5dd629225eb8f3e8d5511136c6012fc549b4a5483a8996e119b8dd55e6551840' 
  AND (
    token = 'j6pqI1Rc/lMwiGrL1OYL5Fln5tm97zRV8j9NkPvNVYY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029