UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'alpsOHkglj+8w4R2Ijlf9uDxy0Fje3m+qgok2O/Yikw=' 
WHERE 
  key_id = '6f8318624f80ce953180d44914ce28387b21695217568b5393bab8f2c05b4b7b' 
  AND (
    token = 'alpsOHkglj+8w4R2Ijlf9uDxy0Fje3m+qgok2O/Yikw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053