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