UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jMDxN7J6P9rP2CUi44Semi4rP76bdUVgx4tAqPXeLeU=' 
WHERE 
  key_id = '250e2b69461475808238974ca17d146b726169e14c9fe643efd02d1c0a476352' 
  AND (
    token = 'jMDxN7J6P9rP2CUi44Semi4rP76bdUVgx4tAqPXeLeU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036