UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'C40ufrk6PlK4Gb4Gm7Qrrm2UJLoa8EmyeDmIUo1So2Q=' 
WHERE 
  key_id = '46b82547f24a0e4e394751d134be87ee633f15ba63f532f51d36b80c42181d60' 
  AND (
    token = 'C40ufrk6PlK4Gb4Gm7Qrrm2UJLoa8EmyeDmIUo1So2Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030