UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Q4DOKljrg/1WrXpKgT986Kxs2NZIhN8Dcyj38ORnblw=' 
WHERE 
  key_id = '6aa9abb93475e2143013f6a66514cc998456202d7484264bd8cb8e7748c6ab4e' 
  AND (
    token = 'Q4DOKljrg/1WrXpKgT986Kxs2NZIhN8Dcyj38ORnblw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043