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