UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bdHTu0uAHKTOM9zhAKWnHTeUM2W2nWIc7t0SjOSnZKI='
WHERE
key_id = 'cfd1520ddd14f000b99c23ca7823ba00c51a793abf394a36f8c69e4fb280448e'
AND (
token = 'bdHTu0uAHKTOM9zhAKWnHTeUM2W2nWIc7t0SjOSnZKI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)