UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1junrqHozA16e9eGeYAVbND2OAX8/TFSPCPBAHSczSs=' 
WHERE 
  key_id = '0aa2929e068a2467d39bce1780ce23d4ffa356b7d4b8047b0c97450a033c4929' 
  AND (
    token = '1junrqHozA16e9eGeYAVbND2OAX8/TFSPCPBAHSczSs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047