UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hYb+gfTm0tZNffuQRXVgGhSKIFlZ3z78wEjfZIfw1TE=' 
WHERE 
  key_id = '66e894be28113346e9ff60a75c4263e39c67e7ca8779db9e28358f98d32a908b' 
  AND (
    token = 'hYb+gfTm0tZNffuQRXVgGhSKIFlZ3z78wEjfZIfw1TE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027