UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '19WOY3nkUDfhAOgYwTAFCT7WzAwpn4TUl9vRHylzcVI='
WHERE
key_id = '4ae5c70dc5040e638a153f5379de7b27115ce7fb2b05283446479a1b1f4a63cf'
AND (
token = '19WOY3nkUDfhAOgYwTAFCT7WzAwpn4TUl9vRHylzcVI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)