UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8aJRpfmxVHc64JuiFTSu/MMf91oZ0QmvtI6oQ3joWjk='
WHERE
key_id = '52263ee41db3f298d64a1a67f54c363b44056247c67524ae4d63e62bb55a71d6'
AND (
token = '8aJRpfmxVHc64JuiFTSu/MMf91oZ0QmvtI6oQ3joWjk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)