UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'buaeVtisrs2Tg45ol2ZD+8PBo+io8L29DXJXk/aqiqs=' 
WHERE 
  key_id = '3250252b502dd810d356af2b88b9a175dc60dba5f82de11cb4e55cbd36530625' 
  AND (
    token = 'buaeVtisrs2Tg45ol2ZD+8PBo+io8L29DXJXk/aqiqs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036