UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0NIkOkZTIclYwvIk6n9tqq8O8biC3prHijKxKuVMxAI='
WHERE
key_id = 'd0c79ceffd6da511fc3ab247a80774ad02ba9327a6cadc818b6131a77327fe5c'
AND (
token = '0NIkOkZTIclYwvIk6n9tqq8O8biC3prHijKxKuVMxAI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)