UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KTN62kk0I82ra0lHfyoAoZj/oLuuENf6nr57PAe0omQ=' 
WHERE 
  key_id = '0c3910853490b319091ee82cbb920703428822a48be28cf5baa3ca1e67bd774b' 
  AND (
    token = 'KTN62kk0I82ra0lHfyoAoZj/oLuuENf6nr57PAe0omQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044