UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hLlxdE7RGAjO80qKEofQxH0q+qydz1+qjIoyoygXkU8='
WHERE
key_id = '581d233472464eda99abeb8201be8f32f2da650f36d57d4237b7a8700de615b4'
AND (
token = 'hLlxdE7RGAjO80qKEofQxH0q+qydz1+qjIoyoygXkU8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)