UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7BKeFCknMHnN7Q3W0Jrq5ZnK3mM0t1crox+nuWyw+BU=' 
WHERE 
  key_id = '4d9ede66341457a720b19db5d2434d734364c5185cf5a2e9ca2d7374cf0e2d6c' 
  AND (
    token = '7BKeFCknMHnN7Q3W0Jrq5ZnK3mM0t1crox+nuWyw+BU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029