UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gU2gEyVLhdUCxLSxBpTRMtusY2+od2Y92sTxT2Udu+E=' 
WHERE 
  key_id = '083363567e60b05eebd142dd946453cf4cc911014225c7237c442d1232c5dbf9' 
  AND (
    token = 'gU2gEyVLhdUCxLSxBpTRMtusY2+od2Y92sTxT2Udu+E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038