UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'q37+iyVPoGrdrCr3bOpMbfh7Y9jU964cSCuUuhZOkj0='
WHERE
key_id = 'f5f40395aa4501b06c1ac94a2b712c4713da0d80f51a764e1601ee3bf9ea904f'
AND (
token = 'q37+iyVPoGrdrCr3bOpMbfh7Y9jU964cSCuUuhZOkj0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)