UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IyshFCFri0g70brlIn0bdV6A7RGxtBc4nDyUxAqLAx8='
WHERE
key_id = 'b34fe71e6cf835f2506c41a2307aa66ead81d83439b3e9cb85f58fd21893c332'
AND (
token = 'IyshFCFri0g70brlIn0bdV6A7RGxtBc4nDyUxAqLAx8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)