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