UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xjOnfJ4xVBCmQ0tOostmycF0YxONZJa+Dxmt9CyHovU='
WHERE
key_id = 'd64f8d9b6304a9a2434ae533dc1d27109e96c415d4ee728de258df98520778ee'
AND (
token = 'xjOnfJ4xVBCmQ0tOostmycF0YxONZJa+Dxmt9CyHovU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)