UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5Wdnr9g2AIy/IDho/n3Ze51025CYRpBy4eNggA+ZPz8='
WHERE
key_id = 'fee46ae2622feafadad96012a0745e11be3d0456e7929f3223b31f8d741982fb'
AND (
token = '5Wdnr9g2AIy/IDho/n3Ze51025CYRpBy4eNggA+ZPz8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)