UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iUeO5dBDt/zcTuPfXng5InuyzTl+5ijXSVB1ZEFsPAc=' 
WHERE 
  key_id = '8d7fdac6026a96fed332476b602ad9a92149b91ac8f3106906f99092f5432515' 
  AND (
    token = 'iUeO5dBDt/zcTuPfXng5InuyzTl+5ijXSVB1ZEFsPAc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030