UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '13DTV8nCj06RfoDDcAksNxYySqautirUkM7uROdfjL0='
WHERE
key_id = '7f82c4ce0638e03caf04bc38b23704210f4a51533ede1cb4dfe39ece78aa1e74'
AND (
token = '13DTV8nCj06RfoDDcAksNxYySqautirUkM7uROdfjL0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)