UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'q3QTb75+66TWCw0Xjj9TQ0UVUt5zzcvrBpIAGvXAPoc=' 
WHERE 
  key_id = '6858adc46d692c9a3fd1bd2a034f7741434272a23934a60e4065beb00a103b9f' 
  AND (
    token = 'q3QTb75+66TWCw0Xjj9TQ0UVUt5zzcvrBpIAGvXAPoc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00075