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

Query time 0.00026