UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'D1+Le3giUF3jedW2fRIQqSdF1jGrBiC0OeUV6LRztE0='
WHERE
key_id = 'de3a2e1d998588ed8ae46330cc300d9fea722962ada42f7854c4fe4e1d7d52a2'
AND (
token = 'D1+Le3giUF3jedW2fRIQqSdF1jGrBiC0OeUV6LRztE0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)