UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nnZgGDmJfwWlTazpd0c629Qlm6w0DF4/hpX5+OH0Lkc=' 
WHERE 
  key_id = '2e0d3374c79382b8c64630a09c4319e313fc163142fa815488393977ae9c9eed' 
  AND (
    token = 'nnZgGDmJfwWlTazpd0c629Qlm6w0DF4/hpX5+OH0Lkc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040