UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NAehljHMMohZ6hGsWDIVP0ywXOLLE572xFo+WhJp6sA=' 
WHERE 
  key_id = '1ed2b41419aca39a849078250e52ed63212bd1f724a58fb1fa5a7aeebd40b6ad' 
  AND (
    token = 'NAehljHMMohZ6hGsWDIVP0ywXOLLE572xFo+WhJp6sA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030