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