UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9YlPoC2rG7X1JFuQxQOTiMU+4TqVXiSKxsWceKvPBY8=' 
WHERE 
  key_id = '75ee7976045ce5fcf370525d4d77010aef609909d7cdb5346d4002637d21406c' 
  AND (
    token = '9YlPoC2rG7X1JFuQxQOTiMU+4TqVXiSKxsWceKvPBY8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040