UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mem/xyuzHO1lrKxGYBDOxiG70sD4G4uHlqVzxfDSOGU=' 
WHERE 
  key_id = 'ef259a96dad20ed668ce691b826ef4149f15d4163f87c7e2e938567bc17bda99' 
  AND (
    token = 'mem/xyuzHO1lrKxGYBDOxiG70sD4G4uHlqVzxfDSOGU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048