UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PMCebTQfLdu4udzpz4a1j44sQFYnBco6PX+cn6YIi88=' 
WHERE 
  key_id = '5aa915b7085145f1067a838622728150d0931de67a892d5b4b0aad8b7a33c9c2' 
  AND (
    token = 'PMCebTQfLdu4udzpz4a1j44sQFYnBco6PX+cn6YIi88=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050