UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gwHau8VXGPLPjRjQNCLJ1Pxvzp2uuEzPvJRj6Wnph+c='
WHERE
key_id = '11258d6a15308d50e11e02a37ddcfbccdc0d52aedc92c2142dca63e52c95a2a0'
AND (
token = 'gwHau8VXGPLPjRjQNCLJ1Pxvzp2uuEzPvJRj6Wnph+c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)