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