UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZaNz5d5SSlL5xnCs489GFzbrJP5JRWP+TvbpaSyfyRE='
WHERE
key_id = '20bdb762a9188837f94f3db7715afb0f6fb54711c0509b25f8393d2b548ffd72'
AND (
token = 'ZaNz5d5SSlL5xnCs489GFzbrJP5JRWP+TvbpaSyfyRE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)