UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'X0RVqIPBBHwOZGMf/QUsNWTTlSIidZQjbvqDxGuaQiQ=' 
WHERE 
  key_id = '38012093b99c34ad1ce6fb1f0b3df5544362089ee460f378b0c6df06a3bdaf36' 
  AND (
    token = 'X0RVqIPBBHwOZGMf/QUsNWTTlSIidZQjbvqDxGuaQiQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032