UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cO/G5d88Cg+2ZJ7uEl0PR9BUZadwo1+XT+Im5jG7RaA=' 
WHERE 
  key_id = 'df4617142d0d47bd28c3b1e2b17c4ae14624b0c9890c562a308fbdf930950a52' 
  AND (
    token = 'cO/G5d88Cg+2ZJ7uEl0PR9BUZadwo1+XT+Im5jG7RaA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039