UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YD865ofPoiC/tGSVl8m3Bt647K1c8X41vk185zmPw8U=' 
WHERE 
  key_id = 'd9326935d532ad1d916e6f20abfd0b90bbcf0b652292169287d34da4dbba8cce' 
  AND (
    token = 'YD865ofPoiC/tGSVl8m3Bt647K1c8X41vk185zmPw8U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040