UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rlVxIvmncUZKlh/oDeCjSXxvt8pCj9yqIVzErX4bq38=' 
WHERE 
  key_id = '8c145f6301dfad65e8c3a4901ea04b5d8094778b1f0797e656cc8d5290410a29' 
  AND (
    token = 'rlVxIvmncUZKlh/oDeCjSXxvt8pCj9yqIVzErX4bq38=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040