UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Srn2c6bG851o54boG7WDvzBghVbb7KJombqgIxMWqzs=' 
WHERE 
  key_id = 'cbcd4445f5180f1072d5d893180595e74b1b4dad0abca81c08a3e899f56af4ea' 
  AND (
    token = 'Srn2c6bG851o54boG7WDvzBghVbb7KJombqgIxMWqzs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016