UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iHuXRrAlaQ4YBzeoqLAameWN1AYLd8rdn/9UbUd+thM=' 
WHERE 
  key_id = '37e5d3bb9df76d1ca2e0f64cc47f5233e7f634fad401215311bbd52a9ab3d5ed' 
  AND (
    token = 'iHuXRrAlaQ4YBzeoqLAameWN1AYLd8rdn/9UbUd+thM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044