UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9H5qOSdF4TboS17CcTNkntKrhRK7amxQry5X0W7/UAo=' 
WHERE 
  key_id = '4977ac310c9315045743fd935509c87f9aef5d1d9d67b43e92b4cea3f77296cc' 
  AND (
    token = '9H5qOSdF4TboS17CcTNkntKrhRK7amxQry5X0W7/UAo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030