UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Mj2MQYxIHc8R+8GbUsNmIUDiG9VOU3z7CO/LAkACrJ8='
WHERE
key_id = 'd1841d1bca8bb1ad68abceaae5747f8f38b20faaf1e8f1247af6c75e2baae48b'
AND (
token = 'Mj2MQYxIHc8R+8GbUsNmIUDiG9VOU3z7CO/LAkACrJ8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)