UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cNgnZ23PsgcsBqfICtHmT+h9qad9AL8n2NUJK2ABFD0='
WHERE
key_id = '246cb450ce59ac85e181d655f3dd8806ae641ef4ffd3f3654a27a71a0e91ac7e'
AND (
token = 'cNgnZ23PsgcsBqfICtHmT+h9qad9AL8n2NUJK2ABFD0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)