UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GwZ956EHd+S7SF5AfN5Xe0Z2hFR10fZCRTeYoetMXck=' 
WHERE 
  key_id = '4ffe03a7968bf346188b2a5491577e2340af016e140223803359b9615e7c9639' 
  AND (
    token = 'GwZ956EHd+S7SF5AfN5Xe0Z2hFR10fZCRTeYoetMXck=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022