UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ocz4CsLIrTeImKUCqA+3qxqsprlyfWXLo+EKgVrotMY='
WHERE
key_id = '9826a9d5966c20d2bd4ee9a080b9fe6a3fabe325241e85f12857924cb0fa2600'
AND (
token = 'ocz4CsLIrTeImKUCqA+3qxqsprlyfWXLo+EKgVrotMY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)