UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rYkRszKHCYVfEJ1nM5FijuIz0YG+3UMf+nYxQaK8OFg=' 
WHERE 
  key_id = '4604a33fcbe82c8b75be9362faa3cd127639f1d34a7a57058155ad4714a7798e' 
  AND (
    token = 'rYkRszKHCYVfEJ1nM5FijuIz0YG+3UMf+nYxQaK8OFg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036