UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lDGyy8SfY3FoD74rSvm1xonFjYMfoKegC4Jg+8DaT54='
WHERE
key_id = 'ec95034c100b493c82f25c04a9dea7ffec397877c3f408474ee552dd01e861b4'
AND (
token = 'lDGyy8SfY3FoD74rSvm1xonFjYMfoKegC4Jg+8DaT54='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)