UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aPUIcst9P2dO1cm0w+e+AOlfby0fsQeyyi74+5f1b68=' 
WHERE 
  key_id = '53f50889defd7c75c83201739c65e0524a159578c3b2db62998ba97b87c6c764' 
  AND (
    token = 'aPUIcst9P2dO1cm0w+e+AOlfby0fsQeyyi74+5f1b68=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031