UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4MH5YoylH++cn0VQ7HhGojDmPmPAFk23RZHRbjyxYRk=' 
WHERE 
  key_id = '84012131ca316d079692c6e3ac50b4a639025f344484120c382fe15302e77841' 
  AND (
    token = '4MH5YoylH++cn0VQ7HhGojDmPmPAFk23RZHRbjyxYRk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040