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