UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'syCl2oGq3FBoB4D89jOb54cLA4Ev9ZvmJGeUakHbKH4='
WHERE
key_id = '1938bc1329d458df6d5e2613b6f67232694406465885b3ada136f7cf3cfd32d3'
AND (
token = 'syCl2oGq3FBoB4D89jOb54cLA4Ev9ZvmJGeUakHbKH4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)