UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UmS592yysIJGtkCAYZ9TnJ26EOKGZkc16GdbJFWhtG4=' 
WHERE 
  key_id = 'dcc256bf842913b06d43fefb49d2857cb88cd35bb02170bede290b91a2be1b13' 
  AND (
    token = 'UmS592yysIJGtkCAYZ9TnJ26EOKGZkc16GdbJFWhtG4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030