UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1kSCffczamK44uQTsyDfnjzYyEvyIauE9QNtHTXHNdM='
WHERE
key_id = 'fcf54fdde3258387fdc1d93158ec46d22422d435e574bf0e200918ee0e6c1558'
AND (
token = '1kSCffczamK44uQTsyDfnjzYyEvyIauE9QNtHTXHNdM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)