UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6/6WdWfCx0h5XJo16vtzRxVJvrDDpFYzJByc5QOwuZA=' 
WHERE 
  key_id = '634c99a6807553a8cc30eb6534a05b380849bb64da88dc4a5e63d6c7213ad986' 
  AND (
    token = '6/6WdWfCx0h5XJo16vtzRxVJvrDDpFYzJByc5QOwuZA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00108